package com.yanqu.road.server.logic.activity.condition.shushan;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.task.TaskModule;
import com.yanqu.road.server.logic.activity.BaseActivityData;
import com.yanqu.road.server.logic.activity.condition.BaseNewRankActivityCondition;

/**
 * @Description 蜀山 历练完成{0}个遭遇{1}
 * @Author cwq
 * @Data 2022/3/15 11:32
 */
public class ShuShanFinishEncounterCondition extends BaseNewRankActivityCondition {

    public ShuShanFinishEncounterCondition(ActivityInfo activityInfo, ActivityConditionInfo activityConditionInfo, BaseActivityData baseActivityData) {
        super(activityInfo, activityConditionInfo, baseActivityData);
    }

    @Override
    public boolean isCompleted(GamePlayer player) {
        if(getValue().compareTo(activityConditionInfo.getParamList().get(3)) >= 0){
            return true;
        }
        return false;
    }

    @Override
    protected void player_BoardLevelHandle(Object object) {
//        ConditionTypeValueArgs args = (ConditionTypeValueArgs) object;
//        if (args.getType() == activityConditionInfo.getParamList().get(0).intValue()) {
//            setValue(BigInteger.valueOf(args.getValue()));
//        }
    }

    @Override
    public void addTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().addListener(eGamePlayerEventType.ShuShanFinishEncounter.getValue(), handle);
    }

    @Override
    public void removeTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().removeListener(eGamePlayerEventType.ShuShanFinishEncounter.getValue(), handle);
    }
}
